package com.lx.pc.service.quotationtrend.impl;

import java.math.BigInteger;
import java.util.List;

import org.springframework.stereotype.Service;

import com.lx.pc.domain.entity.quotationtrend.QuotationtrendEntity;
import com.lx.pc.domain.vo.quotationtrend.QuotationtrendVo;
import com.lx.pc.mybatis.repository.quotationtrend.QuotationtrendRepository;
import com.lx.pc.service.AbstractService;
import com.lx.pc.service.quotationtrend.IQuotationtrendService;
import com.lx.pc.utils.OmsPage;

@Service("quotationtrendService")
public class QuotationtrendServiceImpl extends AbstractService<QuotationtrendEntity, QuotationtrendVo, BigInteger, QuotationtrendRepository> implements IQuotationtrendService{

	@Override
	public int findByQuotationtrendCount(QuotationtrendVo quotationtrend) {

		return repository.findByQuotationtrendCount(quotationtrend);
	}

	@Override
	public List<QuotationtrendVo> findByQuotationtrendList(QuotationtrendVo quotationtrend) {

		return etoV(repository.findByQuotationtrendList(quotationtrend));
	}

	@Override
	public OmsPage<QuotationtrendVo> findByQuotationtrend(QuotationtrendVo quotationtrend, Integer page,
			Integer size) {

		OmsPage<QuotationtrendVo> pages = new OmsPage<QuotationtrendVo>();
		pages.setTotal(repository.findByQuotationtrendCount(quotationtrend));
		List<QuotationtrendEntity> list = repository.findByQuotationtrend(quotationtrend,page = (page - 1) * size,size);
		pages.setResult(etoV(list));
		return pages;
	}

	@Override
	public QuotationtrendVo findByQuotationtrendId(BigInteger id) {

		return etoV(repository.findByQuotationtrendId(id));
	}

}
